var path = require('path');
var webpack = require('webpack')
var DIST_PATH = path.resolve(__dirname, 'dist');
var HtmlPlugin = require('html-webpack-plugin');
var SRC_PATH = path.resolve(__dirname, 'src');
module.exports = {
    entry: './src/index.ts',
    output: {
        path: DIST_PATH,
        filename: 'build.js.[hash]',
    },
    plugins: [
        new HtmlPlugin({
            title: "Clean Vue",
        }),
        new webpack.NamedModulesPlugin(),
        new webpack.HotModuleReplacementPlugin(),
    ],
    devtool: 'inline-source-map',
    devServer: {
        contentBase: './dist',
        hot: true,
    },
    module: {
        rules: [{
                test: /\.vue$/,
                loader: 'vue-loader',
                options: {
                    loaders: {
                        // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
                        // the "scss" and "sass" values for the lang attribute to the right configs here.
                        // other preprocessors should work out of the box, no loader config like this necessary.
                        'scss': 'vue-style-loader!css-loader!sass-loader',
                        'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax',
                    }
                    // other vue-loader options go here
                }
            },
            {
                test: /\.tsx?$/,
                loader: 'ts-loader',
                exclude: /node_modules/,
                options: {
                    appendTsSuffixTo: [/\.vue$/],
                }
            }
        ]
    },
    resolve: {
        extensions: ['.ts', '.js', '.vue', '.json'],
        alias: {
            '@': SRC_PATH + '/components',
            'vue$': 'vue/dist/vue.esm.js'
        }
    },
}